import javax.swing.*;
import java.awt.*;

public class ScorePanel extends JPanel{
	private CardClient main;
	Image img;
    Font font=new Font("仿宋_GB2312",Font.PLAIN,16);
    public ScorePanel(CardClient main) {
    	super();
    	this.main=main;
    	img = Toolkit.getDefaultToolkit().getImage("images/score.jpg");
    }
    
    public void paintComponent(Graphics g) {
		Graphics2D comp = (Graphics2D)g;
		comp.setColor(new Color(0,0,0));
		comp.setFont(font);
		comp.fillRect(0,0,this.getSize().width,getSize().height);
		comp.drawImage(img,0,0,this);
		Table table=main.table;
		if(table==null)return;
		comp.setColor(new Color(153,51,0));
		if(table.seat[0]){
			comp.drawString(table.players[0].name,15,48);
			comp.drawString(""+table.players[0].preScore,100,48);
			comp.drawString(""+table.players[0].score,155,48);
		}
		if(table.seat[1]){
			comp.drawString(table.players[1].name,15,71);
			comp.drawString(""+table.players[1].preScore,100,71);
			comp.drawString(""+table.players[1].score,155,71);
		}
		if(table.seat[2]){
			comp.drawString(table.players[2].name,15,96);
			comp.drawString(""+table.players[2].preScore,100,96);
			comp.drawString(""+table.players[2].score,155,96);
		}
		
	}    
}